#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""
ONES API 配置文件
从环境变量读取配置信息
"""

import os

# ONES API 基础配置 - 直接从环境变量读取避免循环导入
ONES_CONFIG = {
    "base_url": os.getenv("ONES_BASE_URL", "https://sz.ones.cn"),
    "email": "360088940@qq.com",
    "password": "",  # 请填入实际密码或从环境变量读取
    
    # 从环境变量获取的信息
    "user_id": os.getenv("ONES_USER_ID", "K5uAS5Nz"),
    "team_uuid": os.getenv("ONES_TEAM_UUID", "Tuq7N74j"), 
    "org_uuid": os.getenv("ONES_ORG_UUID", "67jG3j67"),
    "auth_token": os.getenv("ONES_AUTH_TOKEN", "eyJhbGciOiJSUzI1NiIsImtpZCI6ImVhNWYwZDJhLTk4NmYtNGUyNC01YTFmLWQyMDllYWQ2YTIwNCIsInR5cCI6IkpXVCJ9.eyJhdWQiOlsiZGVmYXVsdCJdLCJjbGllbnRfaW5mbyI6eyJjbGllbnRfaXAiOiIxMTMuODcuMTYyLjEwNCJ9LCJleHAiOjE3NjQwNDIzMjgsImlhdCI6MTc0ODQ5MDAyOCwianRpIjoiMzI4MTc4OTItYjlhOS00MTFiLTU4ZjItYjMyNzcwODFkMzhkIiwibG9naW5fdGltZSI6MTc0ODQ5MDMyODkyMSwibmJmIjoxNzQ4NDkwMDI4LCJvcmdfdXNlcl91dWlkIjoiSzV1QVM1TnoiLCJvcmdfdXVpZCI6IjY3akczajY3IiwicmVnaW9uX3V1aWQiOiJkZWZhdWx0Iiwic2NvcGVzIjpbIm9wZW5pZCIsIm9mZmxpbmVfYWNjZXNzIiwibGVnYWN5Iiwib25lczpvcmc6ZGVmYXVsdDo2N2pHM2o2NzpLNXVBUzVOeiJdLCJzaWQiOiI5M2JhNGUyZi1lNWMwLTQ4MjItNjI4Ni0zMTQzN2Y4YTdhODUiLCJzdWIiOiJORFZUQXNySDpkZWZhdWx0OjY3akczajY3Oks1dUFTNU56In0.RL-p1spZrA9E3dWTWWapy_NU49uVLZO3S7aF64avuUXzvZFQFJKknrryH3qtJNjuRAMn8QVVlvLYthc3PtGV4DppEWbz_PmVIwlPT51OKh50FJr9xdvFy_wzlH_Q2k_VFJsnphxeTuc7ZM6f8x-GZOp3bs3T7-OFzz2bLoIyc_1g7S07cYh6MNGQOyMiwCaUBcspfxrhSe23Vay_IW4ziMa9KJox6KHlA7oZjjWJUKCGrlx1fk2RvCmOxXuRjnfs2jK7GoIHSx-OgW5BS3gYz6sjmXdXF6dLGE13UfJU4eOiQE4ImFuZylTwHb_kG47yZwa_VH_rpvnWHHhikyT25A")
}

# API端点配置 - 根据文档和实际测试调整
API_ENDPOINTS = {
    # 认证相关
    "login": "/api/project/auth/login",
    "auth_info": "/project/api/auth/info",
    "logout": "/project/api/auth/logout",
    
    # TestCase相关 - 修正API端点
    "libraries": "/project/api/project/team/{team_uuid}/testcase/libraries",
    "plans": "/project/api/project/team/{team_uuid}/testcase/plans",
    
    # 这里可能是问题所在 - 尝试不同的API端点
    "library_cases": "/project/api/project/team/{team_uuid}/testcase/library/{library_uuid}/cases",
    "library_cases_alt": "/project/api/project/team/{team_uuid}/items/graphql",  # 备用GraphQL查询端点
    
    "plan_cases": "/project/api/project/team/{team_uuid}/testcase/plan/{plan_uuid}/cases",
    "add_library": "/project/api/project/team/{team_uuid}/testcase/libraries/add",
    "add_testcase": "/project/api/project/team/{team_uuid}/items/add",
}

# 测试用例配置
TEST_CONFIG = {
    "create_test_library": False,
    "test_library_prefix": "API测试_",
    "timeout": 30,
}

# 预期的响应字段结构
EXPECTED_RESPONSE_FIELDS = {
    "login": {
        "user": ["uuid", "email", "name", "token"],
        "teams": ["uuid", "name", "owner"],
        "org": ["uuid", "name", "owner"]
    },
    "libraries": {
        "libraries": ["uuid", "name", "create_time", "members"]
    },
    "plans": {
        "plans": ["uuid", "name", "owner", "stage", "plan_status"]
    },
    "testcases": {
        "cases": ["uuid", "name", "priority", "type", "assign", "desc"]
    }
} 